//
// SoapTrace.Net - A soap message monitoring utility. 
//
// Copyright (C) 2005 Matthew Ward
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// Matthew Ward (mrward@users.sourceforge.net)


using NUnit.Framework;
using SoapTrace.Core.Formatters;
using System;
using System.Drawing;

namespace SoapTrace.Tests.TextFormatting
{
	/// <summary>
	/// Tests the formatting of a piece of text that has a single colour
	/// associated with it.
	/// </summary>
	[ TestFixture ]
	public class SingleColourTextTestFixture
	{
		FormattedText m_FormattedText;
		string m_Text = "Test";
		Color m_DefaultTextColour = Color.Black;
		FormattedTextItem m_TextItem;
		
		/// <summary>
		/// Initialises each test.
		/// </summary>
		[ SetUp ]
		public void Init( )
		{
			m_FormattedText = new FormattedText( m_DefaultTextColour );
			m_FormattedText.Append( m_Text );
			m_TextItem = m_FormattedText.Items[ 0 ];
		}
		
		/// <summary>
		/// Checks that we have only one formatted text item.
		/// </summary>
		[ Test ]
		public void FormattedTextItemCount( )
		{
			Assert.AreEqual( 1, m_FormattedText.Items.Count, 
			                "Expected a single formatted text item." );
		}
		
		/// <summary>
		/// Checks the single text item's length.
		/// </summary>
		[ Test ]
		public void FormattedTextItemLength( )
		{
			Assert.AreEqual( m_Text.Length, m_TextItem.Text.Length, 
			                "Text item string length is wrong." );
		}
		
		/// <summary>
		/// Checks the text item's colour.
		/// </summary>
		[ Test ]
		public void FormattedTextItemColour( )
		{
			Assert.AreEqual( m_DefaultTextColour, m_TextItem.Colour,
			                "Text item's colour is wrong." );
		}
		
		/// <summary>
		/// Checks that the formatted text item has the correct text.
		/// </summary>
		[ Test ]
		public void FormattedTextItemText( )
		{
			Assert.AreEqual( m_Text, m_TextItem.Text, "Text of item is wrong." );
		}
	}
}
